package cn.chenhuanming.shh.administer;

import cn.chenhuanming.shh.administer.core.SerializationBeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;

/**
 * Created by Administrator on 2017-03-23.
 */
@SpringBootApplication
@EntityScan(
        basePackageClasses = {AdministerApplication.class, Jsr310JpaConverters.class}
)
public class AdministerApplication extends SpringBootServletInitializer {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(AdministerApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(AdministerApplication.class);
    }

    @Bean
    public static BeanFactoryPostProcessor beanFactoryPostProcessor(){
        return new SerializationBeanFactoryPostProcessor();
    }

}
